<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/jsp/common/head.jsp"%>

<div class="right">
     <div class="location">
         <strong>你现在所在的位置是:</strong>
         <span>电子图书列表 >> 添加页面</span>
     </div>
     <div class="providerAdd">
         <form id="ebookEntry" name="ebookEntry" method="post" action="${pageContext.request.contextPath }/bill/add">
             <!--div的class 为error是验证错误，ok是验证成功-->
             <input type="hidden" name="method" value="add">
             <div class="">
                 <label for="title">图书名称:</label>
                 <input type="text" name="title" class="text" id="title" value="">
				 <!-- 放置提示信息 -->
				 <font color="red"></font>
             </div>
             <div>
                 <label for="summary">摘要:</label>
                 <input type="text" name="summary" id="summary" value="">
				 <font color="red"></font>
             </div>
             <div>
                 <label for="uploaduser">上传人：</label>
                 <input type="text" name="uploaduser" id="uploaduser" value="">
				 <font color="red"></font>
             </div>
             <%--<div>
                 <label for="createdate">上传时间：</label>
                 <input type="text" name="createdate" id="createdate" value="">
				 <font color="red"></font>
             </div>--%>

             <div>
                 <label >分类：</label>
                 <select name="categoryId" id="categoryId">
                     <option value="0">==请选择==</option>
		         </select>
				 <font color="red"></font>
             </div>

             <div class="providerAddBtn">
                  <input type="submit" name="add" id="add" value="保存">
				  <input type="button" id="back" name="back" value="返回" onclick="history.go(-1)">
             </div>
         </form>
     </div>
 </div>
</section>
<%@include file="/jsp/common/foot.jsp" %>
<script>

    //页面加载的时候加载供应商信息
    $.ajax({
        url:"/provider/list",
        success:function (data) {
            //console.log(data);

            //创建一个字符串变量
            var optins = "";

            //遍历数组
            for(var i = 0 ; i < data.length ; i++){
                //把数组中的每一个元素的id和名称拼接到下拉项option标签中
                optins += "<option value='"+data[i].id+"'>"+data[i].name+"</option>";
            }
            //把创建的所有的option标签添加到select表的后面
            $("#categoryId").append(optins);

        }
    })
</script>